# Load all the library code.
require File.join(File.dirname(__FILE__), 'load')

# Automatically copy the stylesheets and javascripts into
# /public, along with a warning not to modify them there
require 'fileutils'
[:stylesheets, :javascripts, :images].each do |asset_type|
  source_dir = File.join(File.dirname(__FILE__), 'assets', asset_type.to_s)
  destination_dir = File.join(RAILS_ROOT, 'public', asset_type.to_s, 'presenting')
  FileUtils.mkdir(destination_dir) unless File.exists? destination_dir

  Dir["#{source_dir}/*"].each do |f|
    FileUtils.cp(f, destination_dir) unless f =~ /^\./
  end

  File.open(File.join(destination_dir, 'DO_NOT_EDIT'), 'w') do |f|
    f.puts "These files are copied from vendor/plugins/presenting/assets/#{asset_type}/."
    f.puts "If you wish to make any changes, make the changes there. Better yet, create"
    f.puts "your own CSS file with style overrides."
  end
end